{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import yaml\n",
    "import json\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "path = '../stories/all_stories.yml'\n",
    "with open(path, 'r', encoding='utf-8') as f:\n",
    "    dataset = yaml.load(f.read(),Loader=yaml.Loader)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "data_set = []\n",
    "for dic in dataset:\n",
    "    data = dic['steps']\n",
    "    for index in range(0,len(data),2):\n",
    "        actions = []\n",
    "        slots = []\n",
    "        user_intent = []\n",
    "\n",
    "        current_intent  =  data[index]['intent']\n",
    "        if 'entities' in data[index].keys():\n",
    "            current_slot = data[index]['entities']\n",
    "        elif 'entities' not in data[index].keys():\n",
    "            current_slot = []\n",
    "        current_action = data[index+1]['action']\n",
    "        \n",
    "        pre_intent = []\n",
    "        pre_slot = []\n",
    "        pre_action = []\n",
    "        \n",
    "        pre_history_1 = index-2\n",
    "        if pre_history_1 >= 0:\n",
    "            pre_intent = data[pre_history_1]['intent']\n",
    "            if 'entities' in data[pre_history_1].keys():\n",
    "                pre_slot = data[pre_history_1]['entities']\n",
    "            pre_action = [data[pre_history_1+1]['action']]\n",
    "        \n",
    "        if pre_action == []:\n",
    "            pre_action = ['PAD']\n",
    "        \n",
    "        actions = [current_action]\n",
    "        \n",
    "        slots_sum = [current_slot, pre_slot]            \n",
    "        for i in slots_sum:\n",
    "            if i  != []:\n",
    "                for val in i:\n",
    "                    for key, j in val.items():\n",
    "                        if key not in slots:\n",
    "                            slots.append((key))\n",
    "        if slots == []:\n",
    "            slots = ['PAD']\n",
    "\n",
    "        data_set.append({'previous_action':pre_action, 'slots':slots,'user_intent':[current_intent], 'action':actions})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-RangHood_State'],\n",
       "  'action': ['Control-RangHood_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'mode'],\n",
       "  'user_intent': ['Control-RangHood_State'],\n",
       "  'action': ['Control-RangHood_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_lamp'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_lamp'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_lamp'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'range', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_lamp'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['range', 'operation', 'device'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['Control-Lamp_Lightness'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['Control-Lamp_Lightness'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['Control-Lamp_Lightness'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['sensorvalue', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['Control-Lamp_Lightness'],\n",
       "  'slots': ['sensorvalue'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['sensorvalue', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['inform_sensorvalue'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['sensorvalue', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['inform_sensorvalue'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['sensorvalue', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'mode'],\n",
       "  'user_intent': ['Control-Lamp_Mode'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'color', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'mode', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Mode'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'color'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'mode'],\n",
       "  'user_intent': ['Control-Lamp_Mode'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'color'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'mode'],\n",
       "  'user_intent': ['Control-Lamp_Mode'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['Control-Lamp_Mode'],\n",
       "  'slots': ['address', 'device', 'mode'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['Control-Lamp_Color'],\n",
       "  'slots': ['address', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'target', 'operation', 'color'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['Control-Lamp_Color'],\n",
       "  'slots': ['operation', 'target', 'color', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Timing'],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address', 'time'],\n",
       "  'user_intent': ['Control-Lamp_Timing'],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Timing'],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'previous_action': ['Control-Lamp_Timing'],\n",
       "  'slots': ['address', 'time', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['Control-Fan_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'address'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'device'],\n",
       "  'user_intent': ['Control-Fan_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'device'],\n",
       "  'user_intent': ['Control-Fan_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'device'],\n",
       "  'user_intent': ['Control-Fan_Gear'],\n",
       "  'action': ['Control-Fan_Gear']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Gear'],\n",
       "  'action': ['Control-Fan_Gear']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['mode', 'device'],\n",
       "  'user_intent': ['Control-Fan_Mode'],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['mode', 'device', 'operation'],\n",
       "  'user_intent': ['Control-Fan_Mode'],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Timing'],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['Control-Fan_State'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Timing'],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['Control-Fan_State'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Timing'],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Humidifier_State'],\n",
       "  'action': ['Control-Humidifier_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['gear_level', 'device'],\n",
       "  'user_intent': ['Control-Humidifier_Gear'],\n",
       "  'action': ['Control-Humidifier_Gear']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Humidifier_Gear'],\n",
       "  'action': ['Control-Humidifier_Gear']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'time', 'operation'],\n",
       "  'user_intent': ['Control-Humidifier_Timing'],\n",
       "  'action': ['action_humidifiertiming']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-RiceCooker_State'],\n",
       "  'action': ['Control-RiceCooker_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'mode'],\n",
       "  'user_intent': ['Control-RiceCooker_Mode'],\n",
       "  'action': ['Control-RiceCooker_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'time'],\n",
       "  'user_intent': ['Control-RiceCooker_Timing'],\n",
       "  'action': ['action_RiceCookertiming']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Curtain_State'],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'sensorvalue'],\n",
       "  'user_intent': ['Control-Curtain_State'],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Curtain_State'],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'sensorvalue'],\n",
       "  'user_intent': ['Control-Curtain_State'],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'date_time', 'time', 'operation'],\n",
       "  'user_intent': ['Control-Curtain_Timing'],\n",
       "  'action': ['Control-Curtain_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'date_time', 'time', 'operation', 'sensorvalue'],\n",
       "  'user_intent': ['Control-Curtain_Timing'],\n",
       "  'action': ['Control-Curtain_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Oven_State'],\n",
       "  'action': ['Control-Oven_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Oven_State'],\n",
       "  'action': ['Control-Oven_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['mode', 'device'],\n",
       "  'user_intent': ['Control-Oven_Mode'],\n",
       "  'action': ['Control-Oven_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'temperature'],\n",
       "  'user_intent': ['Control-Oven_Temp'],\n",
       "  'action': ['Control-Oven_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['range', 'operation', 'device'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['address', 'device', 'mode'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['mode'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['Control-AC_Mode'],\n",
       "  'slots': ['address', 'device', 'mode'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'mode'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['Control-AC_Mode'],\n",
       "  'slots': ['address', 'device', 'mode'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['mode', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['Control-AC_Mode'],\n",
       "  'slots': ['mode'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['device', 'address', 'time', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['address', 'time', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['PAD'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['device', 'address', 'time', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['address', 'time', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['time', 'operation', 'address'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'target', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'target', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'target', 'device'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['action_controlDeviceWind'],\n",
       "  'slots': ['address', 'operation', 'target', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['action_controlDeviceWind'],\n",
       "  'slots': ['address', 'operation', 'device', 'target'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['action_controlDeviceWind'],\n",
       "  'slots': ['device', 'address', 'operation', 'target'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['sensorvalue', 'target', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['action_controlDeviceWind'],\n",
       "  'slots': ['sensorvalue', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['device', 'address', 'operation', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['address', 'device', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['device', 'operation', 'temperature', 'address'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['device', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['operation', 'device', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['device', 'address', 'operation', 'temperature'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['address', 'device', 'operation', 'temperature'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['temperature', 'target', 'address'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['target', 'operation', 'address'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'target', 'operation'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['address', 'device', 'target', 'operation'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_Temp']}]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_set"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "data_set# 输入\n",
    "    - Previous system action\n",
    "    - System Action\n",
    "    - Slots\n",
    "    - User intent entities"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Construct dataset map"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "def construct_dataset(dataset):\n",
    "    # 将数据集的 intent entities 以及action 的类别抽取出来\n",
    "    intent_set = ['PAD']\n",
    "    entities_set = ['PAD']\n",
    "    action_set = ['PAD']\n",
    "    for v in dataset:\n",
    "        worth = v['steps']\n",
    "        for i in worth:\n",
    "            for key, val in i.items():\n",
    "                if key  == 'intent':\n",
    "                    intent_set.append(val)\n",
    "                if key == \"action\":\n",
    "                    action_set.append(val)\n",
    "                if key == 'entities':\n",
    "                    for i in val:\n",
    "                        for key , value in i.items():\n",
    "                            entities_set.append(key)\n",
    "    return set(intent_set), set(entities_set), set(action_set)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "intent: {'Control-Lamp_Close', 'Control-Lamp_Timing', 'Control-AC_Close', 'PAD', 'Control-Lamp_Mode', 'Control-AC_Wind', 'Control-Fan_Gear', 'Control-Fan_Wind', 'inform_sensorvalue', 'inform_AC', 'inform_range', 'Control-RiceCooker_Mode', 'Control-RiceCooker_Timing', 'Control-Humidifier_State', 'inform_lamp', 'Control-Fan_Mode', 'Control-Humidifier_Gear', 'Control-AC_Open', 'Control-AC_Timing', 'Control-Oven_Mode', 'Control-Lamp_Color', 'Control-AC_Temp', 'Control-Humidifier_Timing', 'Control-Curtain_Timing', 'Control-AC_Mode', 'Control-Oven_State', 'Control-Lamp_Open', 'Control-RangHood_State', 'Control-Fan_Timing', 'Control-RiceCooker_State', 'Control-Oven_Temp', 'inform_address', 'Control-Lamp_Lightness', 'Control-Fan_State', 'Control-Curtain_State'} \n",
      " inetent_len : 35\n",
      "entities: {'color', 'gear_level', 'sensorvalue', 'target', 'date_time', 'address', 'mode', 'device', 'operation', 'range', 'temperature', 'PAD', 'time'} \n",
      " entities_len : 13\n",
      "action: {'action_RiceCookertiming', 'action_humidifiertiming', 'Control-Lamp_Timing', 'PAD', 'Control-Lamp_Mode', 'Control-Fan_Gear', 'Control-RiceCooker_Mode', 'Control-Humidifier_State', 'Control-Fan_Mode', 'Control-Humidifier_Gear', 'Control-AC_Timing', 'Control-Oven_Mode', 'Control-Lamp_Color', 'Control-AC_Temp', 'action_controlDeviceWind', 'Control-Curtain_Timing', 'Control-AC_Mode', 'Control-Oven_State', 'Control-RangHood_State', 'Control-Fan_Timing', 'Control-RiceCooker_State', 'Control-Oven_Temp', 'Control-Lamp_State', 'Control-Lamp_Lightness', 'Control-Fan_State', 'Control-AC_State', 'Control-Curtain_State'} \n",
      " action_len : 27\n"
     ]
    }
   ],
   "source": [
    "intent, entities, action = construct_dataset(dataset)\n",
    "print('intent: {} \\n inetent_len : {}'.format(intent,len(intent)))\n",
    "print('entities: {} \\n entities_len : {}'.format(entities,len(entities)))\n",
    "print('action: {} \\n action_len : {}'.format(action, len(action)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "  story# extract dataset\n",
    "    - max_history 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'split_data' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-30-d72cea20ef28>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdata_set\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msplit_data\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdataset\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m: name 'split_data' is not defined"
     ]
    }
   ],
   "source": [
    "data_set = split_data(dataset)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "def trans2labelid(vocab,x):\n",
    "        max_len = len(vocab)\n",
    "        print('x: ',x)\n",
    "        labels = [vocab[label] for label in x]\n",
    "        label_onehot = np.eye(max_len)[labels]\n",
    "        values = sum(label_onehot)\n",
    "        return values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "def extract_conv_data(data_set):\n",
    "    dataset_previous_action = []\n",
    "    dataset_slots = []\n",
    "    dataset_user_intent = []\n",
    "    dataset_action = []\n",
    "    for index, i in enumerate(data_set):\n",
    "        print(index)\n",
    "        previous_action = i['previous_action']\n",
    "        if isinstance(previous_action, str):\n",
    "            previous_action = list(previous_action)\n",
    "        print('previous_action: ', previous_action)\n",
    "        dataset_previous_action.append(trans2labelid(action2id,previous_action))\n",
    "        slots = i['slots']\n",
    "        if isinstance(slots, str):\n",
    "            pre_action = list(slots)\n",
    "        dataset_slots.append(trans2labelid(entities2id,slots))\n",
    "        user_intent = i['user_intent']\n",
    "        if isinstance(user_intent, str):\n",
    "            pre_action = list(user_intent)\n",
    "        dataset_user_intent.append(trans2labelid(intent2id,user_intent))\n",
    "        action = i['action']\n",
    "        if isinstance(action, str):\n",
    "            pre_action = list(actiont)\n",
    "        dataset_action.append(trans2labelid(action2id,action))\n",
    "    \n",
    "    return np.array(dataset_previous_action), np.array(dataset_slots), \\\n",
    "            np.array(dataset_user_intent), np.array(dataset_action)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-RangHood_State'],\n",
       "  'action': ['Control-RangHood_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'mode'],\n",
       "  'user_intent': ['Control-RangHood_State'],\n",
       "  'action': ['Control-RangHood_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_lamp'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_lamp'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_lamp'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'range', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_lamp'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Close'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['range', 'operation', 'device'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['Control-Lamp_Lightness'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['Control-Lamp_Lightness'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['Control-Lamp_Lightness'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['sensorvalue', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['Control-Lamp_Lightness'],\n",
       "  'slots': ['sensorvalue'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['sensorvalue', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['inform_sensorvalue'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['sensorvalue', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['inform_sensorvalue'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Open'],\n",
       "  'action': ['Control-Lamp_State']},\n",
       " {'previous_action': ['Control-Lamp_State'],\n",
       "  'slots': ['sensorvalue', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Lightness'],\n",
       "  'action': ['Control-Lamp_Lightness']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'mode'],\n",
       "  'user_intent': ['Control-Lamp_Mode'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'color', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'mode', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Mode'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'color'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'mode'],\n",
       "  'user_intent': ['Control-Lamp_Mode'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'color'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'mode'],\n",
       "  'user_intent': ['Control-Lamp_Mode'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['Control-Lamp_Mode'],\n",
       "  'slots': ['address', 'device', 'mode'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['Control-Lamp_Color'],\n",
       "  'slots': ['address', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'target', 'operation', 'color'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['Control-Lamp_Color'],\n",
       "  'slots': ['operation', 'target', 'color', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Color'],\n",
       "  'action': ['Control-Lamp_Color']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-Lamp_Timing'],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address', 'time'],\n",
       "  'user_intent': ['Control-Lamp_Timing'],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-Lamp_Timing'],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'previous_action': ['Control-Lamp_Timing'],\n",
       "  'slots': ['address', 'time', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-Lamp_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['Control-Fan_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'address'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'device'],\n",
       "  'user_intent': ['Control-Fan_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'device'],\n",
       "  'user_intent': ['Control-Fan_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'device'],\n",
       "  'user_intent': ['Control-Fan_Gear'],\n",
       "  'action': ['Control-Fan_Gear']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Gear'],\n",
       "  'action': ['Control-Fan_Gear']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['mode', 'device'],\n",
       "  'user_intent': ['Control-Fan_Mode'],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['mode', 'device', 'operation'],\n",
       "  'user_intent': ['Control-Fan_Mode'],\n",
       "  'action': ['Control-Fan_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Timing'],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['Control-Fan_State'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Timing'],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_State'],\n",
       "  'action': ['Control-Fan_State']},\n",
       " {'previous_action': ['Control-Fan_State'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-Fan_Timing'],\n",
       "  'action': ['Control-Fan_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Humidifier_State'],\n",
       "  'action': ['Control-Humidifier_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['gear_level', 'device'],\n",
       "  'user_intent': ['Control-Humidifier_Gear'],\n",
       "  'action': ['Control-Humidifier_Gear']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-Humidifier_Gear'],\n",
       "  'action': ['Control-Humidifier_Gear']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'time', 'operation'],\n",
       "  'user_intent': ['Control-Humidifier_Timing'],\n",
       "  'action': ['action_humidifiertiming']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-RiceCooker_State'],\n",
       "  'action': ['Control-RiceCooker_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'mode'],\n",
       "  'user_intent': ['Control-RiceCooker_Mode'],\n",
       "  'action': ['Control-RiceCooker_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'time'],\n",
       "  'user_intent': ['Control-RiceCooker_Timing'],\n",
       "  'action': ['action_RiceCookertiming']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Curtain_State'],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'sensorvalue'],\n",
       "  'user_intent': ['Control-Curtain_State'],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Curtain_State'],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'sensorvalue'],\n",
       "  'user_intent': ['Control-Curtain_State'],\n",
       "  'action': ['Control-Curtain_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'date_time', 'time', 'operation'],\n",
       "  'user_intent': ['Control-Curtain_Timing'],\n",
       "  'action': ['Control-Curtain_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'date_time', 'time', 'operation', 'sensorvalue'],\n",
       "  'user_intent': ['Control-Curtain_Timing'],\n",
       "  'action': ['Control-Curtain_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Oven_State'],\n",
       "  'action': ['Control-Oven_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-Oven_State'],\n",
       "  'action': ['Control-Oven_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['mode', 'device'],\n",
       "  'user_intent': ['Control-Oven_Mode'],\n",
       "  'action': ['Control-Oven_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'temperature'],\n",
       "  'user_intent': ['Control-Oven_Temp'],\n",
       "  'action': ['Control-Oven_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'device', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['range', 'device', 'operation'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['range', 'operation', 'device'],\n",
       "  'user_intent': ['inform_range'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['address', 'device', 'mode'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['mode'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['Control-AC_Mode'],\n",
       "  'slots': ['address', 'device', 'mode'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'mode'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['Control-AC_Mode'],\n",
       "  'slots': ['address', 'device', 'mode'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['mode', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['Control-AC_Mode'],\n",
       "  'slots': ['mode'],\n",
       "  'user_intent': ['Control-AC_Mode'],\n",
       "  'action': ['Control-AC_Mode']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['device', 'address', 'time', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['address', 'time', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['PAD'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['device', 'address', 'time', 'operation'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['time', 'operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['Control-AC_Timing'],\n",
       "  'slots': ['address', 'time', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['time', 'operation', 'address'],\n",
       "  'user_intent': ['Control-AC_Timing'],\n",
       "  'action': ['Control-AC_Timing']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'target', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['sensorvalue', 'target', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'target', 'device'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['action_controlDeviceWind'],\n",
       "  'slots': ['address', 'operation', 'target', 'device'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['action_controlDeviceWind'],\n",
       "  'slots': ['address', 'operation', 'device', 'target'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['action_controlDeviceWind'],\n",
       "  'slots': ['device', 'address', 'operation', 'target'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['sensorvalue', 'target', 'operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['action_controlDeviceWind'],\n",
       "  'slots': ['sensorvalue', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device', 'address'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['device', 'address', 'operation', 'target'],\n",
       "  'user_intent': ['Control-AC_Wind'],\n",
       "  'action': ['action_controlDeviceWind']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['address', 'device', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'address', 'operation'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['device', 'operation', 'temperature', 'address'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['device', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['operation', 'device', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Close'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['device', 'address', 'operation', 'temperature'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'operation', 'temperature'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['address', 'device', 'operation', 'temperature'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['temperature', 'target', 'address'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['operation', 'device'],\n",
       "  'user_intent': ['Control-AC_Open'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['address', 'operation', 'device'],\n",
       "  'user_intent': ['inform_AC'],\n",
       "  'action': ['Control-AC_State']},\n",
       " {'previous_action': ['Control-AC_State'],\n",
       "  'slots': ['target', 'operation', 'address'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['PAD'],\n",
       "  'slots': ['device', 'target', 'operation'],\n",
       "  'user_intent': ['Control-AC_Temp'],\n",
       "  'action': ['Control-AC_Temp']},\n",
       " {'previous_action': ['Control-AC_Temp'],\n",
       "  'slots': ['address', 'device', 'target', 'operation'],\n",
       "  'user_intent': ['inform_address'],\n",
       "  'action': ['Control-AC_Temp']}]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('./DM_char.json', mode='r', encoding='utf-8') as f:\n",
    "    dicts = json.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "action2id = dicts['action2id']\n",
    "intent2id = dicts['intent2id']\n",
    "entities2id = dicts['entities2id']\n",
    "id2action = dicts['id2action']\n",
    "id2intent = dicts['id2intent']\n",
    "id2entities = dicts['id2entities']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-RangHood_State']\n",
      "x:  ['Control-RangHood_State']\n",
      "1\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'mode']\n",
      "x:  ['Control-RangHood_State']\n",
      "x:  ['Control-RangHood_State']\n",
      "2\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "3\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "4\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['inform_lamp']\n",
      "x:  ['Control-Lamp_State']\n",
      "5\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "6\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['address', 'device', 'operation']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-Lamp_State']\n",
      "7\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "8\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['range', 'device', 'operation']\n",
      "x:  ['inform_range']\n",
      "x:  ['Control-Lamp_State']\n",
      "9\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['range', 'device', 'operation']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "10\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "11\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['inform_lamp']\n",
      "x:  ['Control-Lamp_State']\n",
      "12\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "13\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-Lamp_State']\n",
      "14\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['Control-Lamp_Close']\n",
      "x:  ['Control-Lamp_State']\n",
      "15\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Lamp_Close']\n",
      "x:  ['Control-Lamp_State']\n",
      "16\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['inform_lamp']\n",
      "x:  ['Control-Lamp_State']\n",
      "17\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Lamp_Close']\n",
      "x:  ['Control-Lamp_State']\n",
      "18\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['range', 'device', 'operation']\n",
      "x:  ['inform_range']\n",
      "x:  ['Control-Lamp_State']\n",
      "19\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'range', 'operation']\n",
      "x:  ['Control-Lamp_Close']\n",
      "x:  ['Control-Lamp_State']\n",
      "20\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Lamp_Close']\n",
      "x:  ['Control-Lamp_State']\n",
      "21\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['inform_lamp']\n",
      "x:  ['Control-Lamp_State']\n",
      "22\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Lamp_Close']\n",
      "x:  ['Control-Lamp_State']\n",
      "23\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['range', 'operation', 'device']\n",
      "x:  ['inform_range']\n",
      "x:  ['Control-Lamp_State']\n",
      "24\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "25\n",
      "previous_action:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "26\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "27\n",
      "previous_action:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "28\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "29\n",
      "previous_action:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "30\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "31\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['sensorvalue', 'device', 'address']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "32\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "33\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['sensorvalue', 'operation', 'device', 'address']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "34\n",
      "previous_action:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['sensorvalue']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "35\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "36\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "37\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "38\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['sensorvalue', 'operation', 'device', 'address']\n",
      "x:  ['inform_sensorvalue']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "39\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "40\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['sensorvalue', 'operation', 'device', 'address']\n",
      "x:  ['inform_sensorvalue']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "41\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address']\n",
      "x:  ['Control-Lamp_Open']\n",
      "x:  ['Control-Lamp_State']\n",
      "42\n",
      "previous_action:  ['Control-Lamp_State']\n",
      "x:  ['Control-Lamp_State']\n",
      "x:  ['sensorvalue', 'operation', 'device', 'address']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "x:  ['Control-Lamp_Lightness']\n",
      "43\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'mode']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "44\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'color', 'address']\n",
      "x:  ['Control-Lamp_Color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "45\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'mode', 'address']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "46\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "47\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'mode']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "48\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "49\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'mode']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "50\n",
      "previous_action:  ['Control-Lamp_Mode']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "x:  ['address', 'device', 'mode']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-Lamp_Mode']\n",
      "51\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device']\n",
      "x:  ['Control-Lamp_Color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "52\n",
      "previous_action:  ['Control-Lamp_Color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "x:  ['address', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-Lamp_Color']\n",
      "53\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'target', 'operation', 'color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "54\n",
      "previous_action:  ['Control-Lamp_Color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "x:  ['operation', 'target', 'color', 'device', 'address']\n",
      "x:  ['Control-Lamp_Color']\n",
      "x:  ['Control-Lamp_Color']\n",
      "55\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['time', 'operation', 'device', 'address']\n",
      "x:  ['Control-Lamp_Timing']\n",
      "x:  ['Control-Lamp_Timing']\n",
      "56\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address', 'time']\n",
      "x:  ['Control-Lamp_Timing']\n",
      "x:  ['Control-Lamp_Timing']\n",
      "57\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['time', 'operation', 'device']\n",
      "x:  ['Control-Lamp_Timing']\n",
      "x:  ['Control-Lamp_Timing']\n",
      "58\n",
      "previous_action:  ['Control-Lamp_Timing']\n",
      "x:  ['Control-Lamp_Timing']\n",
      "x:  ['address', 'time', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-Lamp_Timing']\n",
      "59\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "60\n",
      "previous_action:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['address', 'device', 'operation']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "61\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation', 'address']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "62\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "63\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Fan_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "64\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['sensorvalue', 'device']\n",
      "x:  ['Control-Fan_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "65\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['sensorvalue', 'device']\n",
      "x:  ['Control-Fan_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "66\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['sensorvalue', 'device']\n",
      "x:  ['Control-Fan_Gear']\n",
      "x:  ['Control-Fan_Gear']\n",
      "67\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Fan_Gear']\n",
      "x:  ['Control-Fan_Gear']\n",
      "68\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['mode', 'device']\n",
      "x:  ['Control-Fan_Mode']\n",
      "x:  ['Control-Fan_Mode']\n",
      "69\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['mode', 'device', 'operation']\n",
      "x:  ['Control-Fan_Mode']\n",
      "x:  ['Control-Fan_Mode']\n",
      "70\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['time', 'operation', 'device']\n",
      "x:  ['Control-Fan_Timing']\n",
      "x:  ['Control-Fan_Timing']\n",
      "71\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "72\n",
      "previous_action:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['time', 'operation', 'device']\n",
      "x:  ['Control-Fan_Timing']\n",
      "x:  ['Control-Fan_Timing']\n",
      "73\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "74\n",
      "previous_action:  ['Control-Fan_State']\n",
      "x:  ['Control-Fan_State']\n",
      "x:  ['time', 'operation', 'device']\n",
      "x:  ['Control-Fan_Timing']\n",
      "x:  ['Control-Fan_Timing']\n",
      "75\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Humidifier_State']\n",
      "x:  ['Control-Humidifier_State']\n",
      "76\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['gear_level', 'device']\n",
      "x:  ['Control-Humidifier_Gear']\n",
      "x:  ['Control-Humidifier_Gear']\n",
      "77\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-Humidifier_Gear']\n",
      "x:  ['Control-Humidifier_Gear']\n",
      "78\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'time', 'operation']\n",
      "x:  ['Control-Humidifier_Timing']\n",
      "x:  ['action_humidifiertiming']\n",
      "79\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-RiceCooker_State']\n",
      "x:  ['Control-RiceCooker_State']\n",
      "80\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'mode']\n",
      "x:  ['Control-RiceCooker_Mode']\n",
      "x:  ['Control-RiceCooker_Mode']\n",
      "81\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'time']\n",
      "x:  ['Control-RiceCooker_Timing']\n",
      "x:  ['action_RiceCookertiming']\n",
      "82\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Curtain_State']\n",
      "x:  ['Control-Curtain_State']\n",
      "83\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation', 'sensorvalue']\n",
      "x:  ['Control-Curtain_State']\n",
      "x:  ['Control-Curtain_State']\n",
      "84\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Curtain_State']\n",
      "x:  ['Control-Curtain_State']\n",
      "85\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation', 'sensorvalue']\n",
      "x:  ['Control-Curtain_State']\n",
      "x:  ['Control-Curtain_State']\n",
      "86\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'date_time', 'time', 'operation']\n",
      "x:  ['Control-Curtain_Timing']\n",
      "x:  ['Control-Curtain_Timing']\n",
      "87\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'date_time', 'time', 'operation', 'sensorvalue']\n",
      "x:  ['Control-Curtain_Timing']\n",
      "x:  ['Control-Curtain_Timing']\n",
      "88\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Oven_State']\n",
      "x:  ['Control-Oven_State']\n",
      "89\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-Oven_State']\n",
      "x:  ['Control-Oven_State']\n",
      "90\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['mode', 'device']\n",
      "x:  ['Control-Oven_Mode']\n",
      "x:  ['Control-Oven_Mode']\n",
      "91\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'temperature']\n",
      "x:  ['Control-Oven_Temp']\n",
      "x:  ['Control-Oven_Temp']\n",
      "92\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['address', 'device', 'operation']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "93\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "94\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['address', 'device', 'operation']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_State']\n",
      "95\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "96\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['address', 'device', 'operation']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-AC_State']\n",
      "97\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "98\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['range', 'device', 'operation']\n",
      "x:  ['inform_range']\n",
      "x:  ['Control-AC_State']\n",
      "99\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['range', 'device', 'operation']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "100\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "101\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_State']\n",
      "102\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "103\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-AC_State']\n",
      "104\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['address', 'device', 'operation']\n",
      "x:  ['Control-AC_Close']\n",
      "x:  ['Control-AC_State']\n",
      "105\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation']\n",
      "x:  ['Control-AC_Close']\n",
      "x:  ['Control-AC_State']\n",
      "106\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['address', 'device', 'operation']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_State']\n",
      "107\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['range', 'device', 'operation']\n",
      "x:  ['Control-AC_Close']\n",
      "x:  ['Control-AC_State']\n",
      "108\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-AC_Close']\n",
      "x:  ['Control-AC_State']\n",
      "109\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_State']\n",
      "110\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-AC_Close']\n",
      "x:  ['Control-AC_State']\n",
      "111\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-AC_State']\n",
      "112\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-AC_Close']\n",
      "x:  ['Control-AC_State']\n",
      "113\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['range', 'operation', 'device']\n",
      "x:  ['inform_range']\n",
      "x:  ['Control-AC_State']\n",
      "114\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['address', 'device', 'mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "115\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "116\n",
      "previous_action:  ['Control-AC_Mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "x:  ['address', 'device', 'mode']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_Mode']\n",
      "117\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "118\n",
      "previous_action:  ['Control-AC_Mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "x:  ['address', 'device', 'mode']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_Mode']\n",
      "119\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "120\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['mode', 'operation', 'device', 'address']\n",
      "x:  ['Control-AC_Mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "121\n",
      "previous_action:  ['Control-AC_Mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "x:  ['mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "x:  ['Control-AC_Mode']\n",
      "122\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['time', 'operation', 'device', 'address']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "123\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['time', 'operation', 'device']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "124\n",
      "previous_action:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['device', 'address', 'time', 'operation']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_Timing']\n",
      "125\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['time', 'operation', 'device']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "126\n",
      "previous_action:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['address', 'time', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-AC_Timing']\n",
      "127\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "128\n",
      "previous_action:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['time', 'operation', 'device']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "129\n",
      "previous_action:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['device', 'address', 'time', 'operation']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_Timing']\n",
      "130\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['time', 'operation', 'device']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "131\n",
      "previous_action:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['address', 'time', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-AC_Timing']\n",
      "132\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "133\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-AC_State']\n",
      "134\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['time', 'operation', 'address']\n",
      "x:  ['Control-AC_Timing']\n",
      "x:  ['Control-AC_Timing']\n",
      "135\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'target', 'device', 'address']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "136\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['sensorvalue', 'target', 'device', 'address']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "137\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'target', 'device']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "138\n",
      "previous_action:  ['action_controlDeviceWind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "x:  ['address', 'operation', 'target', 'device']\n",
      "x:  ['inform_address']\n",
      "x:  ['action_controlDeviceWind']\n",
      "139\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'target']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "140\n",
      "previous_action:  ['action_controlDeviceWind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "x:  ['address', 'operation', 'device', 'target']\n",
      "x:  ['inform_address']\n",
      "x:  ['action_controlDeviceWind']\n",
      "141\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address', 'target']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "142\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'target']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "143\n",
      "previous_action:  ['action_controlDeviceWind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "x:  ['device', 'address', 'operation', 'target']\n",
      "x:  ['inform_AC']\n",
      "x:  ['action_controlDeviceWind']\n",
      "144\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "145\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['sensorvalue', 'target', 'operation', 'device', 'address']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "146\n",
      "previous_action:  ['action_controlDeviceWind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "x:  ['sensorvalue', 'target']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "147\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device', 'address']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "148\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['device', 'address', 'operation', 'target']\n",
      "x:  ['Control-AC_Wind']\n",
      "x:  ['action_controlDeviceWind']\n",
      "149\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'operation', 'temperature']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "150\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['address', 'device', 'operation', 'temperature']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "151\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'address', 'operation']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "152\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['device', 'operation', 'temperature', 'address']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "153\n",
      "previous_action:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['device', 'operation', 'temperature']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "154\n",
      "previous_action:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['operation', 'device', 'temperature']\n",
      "x:  ['Control-AC_Close']\n",
      "x:  ['Control-AC_State']\n",
      "155\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation', 'temperature']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "156\n",
      "previous_action:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['device', 'address', 'operation', 'temperature']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_Temp']\n",
      "157\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'operation', 'temperature']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "158\n",
      "previous_action:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['address', 'device', 'operation', 'temperature']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-AC_Temp']\n",
      "159\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "160\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_State']\n",
      "161\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['temperature', 'target', 'address']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "162\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['operation', 'device']\n",
      "x:  ['Control-AC_Open']\n",
      "x:  ['Control-AC_State']\n",
      "163\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['address', 'operation', 'device']\n",
      "x:  ['inform_AC']\n",
      "x:  ['Control-AC_State']\n",
      "164\n",
      "previous_action:  ['Control-AC_State']\n",
      "x:  ['Control-AC_State']\n",
      "x:  ['target', 'operation', 'address']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "165\n",
      "previous_action:  ['PAD']\n",
      "x:  ['PAD']\n",
      "x:  ['device', 'target', 'operation']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "166\n",
      "previous_action:  ['Control-AC_Temp']\n",
      "x:  ['Control-AC_Temp']\n",
      "x:  ['address', 'device', 'target', 'operation']\n",
      "x:  ['inform_address']\n",
      "x:  ['Control-AC_Temp']\n"
     ]
    }
   ],
   "source": [
    "previous_action, slots, user_intent, action = extract_conv_data(data_set) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
